const TerserPlugin = require('terser-webpack-plugin');
 
module.exports = {
  mode: 'production',
  optimization: {
    minimize: true,
    minimizer: [new TerserPlugin({
      terserOptions: {
        compress: {
          drop_console: true, // 移除console语句
        },
        mangle: {
          // 混淆变量和函数名
          reserved: ['webpackJsonp'], // 保留特定的变量名
        },
      },
      extractComments: false, // 不提取注释
    })],
  },
};